package com.huqing.icu.rentuser.controller;

import com.huqing.icu.base.BaseController;
import com.huqing.icu.base.IdReq;
import com.huqing.icu.client.UserFeignClient;
import com.huqing.icu.inout.resp.user.UserInfoQueryResp;
import com.huqing.icu.rentuser.service.IUserNumPanelService;
import com.huqing.icu.rentuser.service.IUserService;
import com.huqing.icu.req.UserNumIncrReq;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description 用户的feign接口
 * @Author huqing
 * @Date 2025/9/6 18:27
 **/
@RestController
@RequestMapping("/api/user/feign")
@Tag(name = "用户的feign接口")
public class UserFeignController extends BaseController implements UserFeignClient {

    @Autowired
    private IUserService iUserService;
    @Autowired
    private IUserNumPanelService iUserNumPanelService;

    @Operation(summary = "查询单个用户信息")
    @Override
    public UserInfoQueryResp getUserById(Long userId) {
        return iUserService.getByUserId(userId);
    }

    @Operation(summary = "批量查询用户信息")
    @Override
    public List<UserInfoQueryResp> queryList(IdReq idReq) {
        return iUserService.getByUserIdList(idReq.getIdList());
    }

    @Operation(summary = "日活/月活/年活用户数量增加")
    @Override
    public String incrUserNum(UserNumIncrReq incrReq) {
        //Long operateUserId = checkAndGetUserId(request);
        return jsonSuccessForNull(iUserNumPanelService.incrAddUserNumAndUserNum(incrReq.getDateList(), incrReq.getTypeList()));
    }
}
